<template>
	<view class="collection">
		<view class="goodsList">
			<view class="box" v-for="(item,index) in imgList" :key="item" @click="to(item)">
				<image  :src="item.mainImageUrl" mode="aspectFill"></image>
				<view class="intro">
					<text class="name">{{item.name}}</text>
					<text class="price">￥{{item.retailPrice}}</text>
				</view>
			</view>
		</view>
		<view class="zw" v-if="imgList.length==0">
			<van-empty  description="你还没有收藏哦" />
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			imgList:[],
			searchValue:''
		}	
	},
	onLoad(query) {
		this.listUserCommodity(query.userId)
	},
	methods: {
		to(item){
			uni.navigateTo({
				url: '/pages/detail/index?id='+item.id
			});
		},
		listUserCommodity(userId){
			const requestParam = {
				url: "/app/mall/listUserCommodity",
				method: "GET",
				data:{
					userId: userId,
				},
				callBack: (res) => {
					console.log(res)
					this.imgList=res.rows;
				}
			}
			this.$request(requestParam);
		},	
	},
}		
</script>

<style lang="scss">
@import './style.scss';
</style>
